package com.ruoyi.ldzlsb.utils;

import com.ruoyi.ldzlsb.domain.SbEquipmentType;
import org.springframework.beans.BeanUtils;

import com.ruoyi.ldzlsb.domain.SbEquipment;
import com.ruoyi.ldzlsb.domain.SbRepairApplication;

import java.util.ArrayList;
import java.util.List;

/**
 * 实体类映射工具类
 * 用于处理新旧包路径下的实体类之间的转换
 * 
 * @author ruoyi
 * @date 2025-07-22
 */
public class EntityMappingUtils {

    /**
     * 将旧包路径下的报修单实体转换为新包路径下的实体
     * 
     * @param source 旧实体
     * @return 新实体
     */
    public static com.ruoyi.ldzlsb.domain.SbRepairApplication toNewRepairApplication(com.ruoyi.ldzlsb.domain.SbRepairApplication source) {
        if (source == null) {
            return null;
        }
        com.ruoyi.ldzlsb.domain.SbRepairApplication target = new com.ruoyi.ldzlsb.domain.SbRepairApplication();
        BeanUtils.copyProperties(source, target);
        return target;
    }
    
    /**
     * 将新包路径下的报修单实体转换为旧包路径下的实体
     * 
     * @param source 新实体
     * @return 旧实体
     */
    public static com.ruoyi.ldzlsb.domain.SbRepairApplication toOldRepairApplication(com.ruoyi.ldzlsb.domain.SbRepairApplication source) {
        if (source == null) {
            return null;
        }
        com.ruoyi.ldzlsb.domain.SbRepairApplication target = new com.ruoyi.ldzlsb.domain.SbRepairApplication();
        BeanUtils.copyProperties(source, target);
        return target;
    }
    
    /**
     * 将旧包路径下的报修单实体列表转换为新包路径下的实体列表
     * 
     * @param sourceList 旧实体列表
     * @return 新实体列表
     */
    public static List<com.ruoyi.ldzlsb.domain.SbRepairApplication> toNewRepairApplicationList(List<com.ruoyi.ldzlsb.domain.SbRepairApplication> sourceList) {
        if (sourceList == null) {
            return null;
        }
        List<com.ruoyi.ldzlsb.domain.SbRepairApplication> targetList = new ArrayList<>(sourceList.size());
        for (com.ruoyi.ldzlsb.domain.SbRepairApplication source : sourceList) {
            targetList.add(toNewRepairApplication(source));
        }
        return targetList;
    }
    
    /**
     * 将新包路径下的报修单实体列表转换为旧包路径下的实体列表
     * 
     * @param sourceList 新实体列表
     * @return 旧实体列表
     */
    public static List<com.ruoyi.ldzlsb.domain.SbRepairApplication> toOldRepairApplicationList(List<com.ruoyi.ldzlsb.domain.SbRepairApplication> sourceList) {
        if (sourceList == null) {
            return null;
        }
        List<com.ruoyi.ldzlsb.domain.SbRepairApplication> targetList = new ArrayList<>(sourceList.size());
        for (com.ruoyi.ldzlsb.domain.SbRepairApplication source : sourceList) {
            targetList.add(toOldRepairApplication(source));
        }
        return targetList;
    }
    
    /**
     * 将旧包路径下的设备类型实体转换为新包路径下的实体
     * 
     * @param source 旧实体
     * @return 新实体
     */
    public static com.ruoyi.ldzlsb.domain.SbEquipmentType toNewEquipmentType(SbEquipmentType source) {
        if (source == null) {
            return null;
        }
        com.ruoyi.ldzlsb.domain.SbEquipmentType target = new com.ruoyi.ldzlsb.domain.SbEquipmentType();
        BeanUtils.copyProperties(source, target);
        return target;
    }
    
    /**
     * 将旧包路径下的设备实体转换为新包路径下的实体
     * 
     * @param source 旧实体
     * @return 新实体
     */
    public static com.ruoyi.ldzlsb.domain.SbEquipment toNewEquipment(SbEquipment source) {
        if (source == null) {
            return null;
        }
        com.ruoyi.ldzlsb.domain.SbEquipment target = new com.ruoyi.ldzlsb.domain.SbEquipment();
        BeanUtils.copyProperties(source, target);
        return target;
    }
} 